<template>
  <div id="createFile">
    <iframe id="create_iframe" ref="docContent" class="frame-content" :src="src"/>
  </div>
</template>

<script>
  import { getAction } from '@/api/manage'

  export default {
    name: 'createFile',
    data() {
      return {
        src: '',
        url: '/eoa/wps/oaWpsFile/createTemplateFile'
      }
    },
    created() {
      this.getCreateFilePath(sessionStorage.createFileUrlType)
    },
    methods: {
      getCreateFilePath(type) {
        getAction(this.url, { template: type }).then(res => {
          console.log(res)
          if (res.success) {
            console.log('res.message===========' + res.message)
            this.src = res.message
          } else {
            this.$message.error('请求错误！')
          }
        }).catch(() => {
          this.$message.error('请求错误！')
        })
      }
    },
    mounted() {
    }
  }
</script>

<style scoped>
  #create_iframe {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99;
  }

  .frame-content {
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
    width: 100%;
    height: 100%;
    border: none;
    /* 防止双击缩放 */
    touch-action: manipulation;
  }

  body #createFile {
    font-family: 'Avenir', Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-align: center;
    color: #2c3e50;
    height: 100%;
    width: 100%;
    /* 防止双击缩放 */
    touch-action: manipulation;
  }

  body #createFile #wps-iframe {
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
    height: 100%;
    /* 防止双击缩放 */
    touch-action: manipulation;
  }
</style>